// The class implements a job, and handles its path location and required effects.

#include "../include/Job.h"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

using namespace std;
using namespace cv;

// Class constructor. Receives the input and output representation of the job, and its requested OpenCV effects.
Job::Job(int& inputRepresentation, int& outputRepresentation, vector<Effect*>& effects) : input(inputRepresentation), output(outputRepresentation), effectsList(effects){
}

// Class destructor.
Job::~Job(void){}

// Returns the input representation of the job.
int Job::getInput() {
	return input;
}

// Returns the output representation of the job.
int Job::getOutput() {
	return output;
}

// Processes all of the requested OpenCV effects of the job, in the order it was received.
void Job::processAllEffects(Mat& src) {
	Mat dst;
	for (vector<Effect*>::iterator it = effectsList.begin(); it != effectsList.end(); it++) {
		(*it)->processEffect(src, dst);
		dst.copyTo(src);
	}
	dst.release();
}

